package com.sky.mapper.common;

import com.github.pagehelper.Page;
import com.sky.dto.DishPageQueryDTO;
import com.sky.pojo.Dish;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface DishMapper {
    Page<Dish> pageQuery(DishPageQueryDTO dishPageQueryDTO);

    @Insert("insert into dish (name, category_id, price, image, description, create_time, update_time, create_user, update_user, status,make_time) values (#{name},#{categoryId},#{price},#{image},#{description},#{createTime},#{updateTime},#{createUser},#{updateUser},#{status},#{makeTime})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void save(Dish dish);

    Integer selectStatusById(@Param("ids") List<Long> ids, @Param("status") Integer status);

    void delete(@Param("ids") List<Long> ids);


    DishVO getByIdWithFlavor(Long id);

    void updateWithFlavor(Dish dish);

    @Update("update dish set status = #{status} where id = #{id}")
    void startOrStop(Integer status, Long id);

    List<Dish> list(Dish dish);

    @Select("select * from sky_take_out_new.dish where id = #{id}")
    Dish getById(Long dishId);

//    Dish getById(Long dishId);
}